package com.wxzz.elearing.livetelecast.service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wxzz.elearing.livetelecast.dto.*;
import com.wxzz.elearing.livetelecast.entity.Activity;
import com.wxzz.elearing.livetelecast.entity.LivePushCallbackEntity;
import com.wxzz.elearing.livetelecast.entity.PlatformLivetelecast;
import com.wxzz.elearing.livetelecast.entity.WxUserPlatformLivetelecast;
import com.wxzz.elearing.livetelecast.vo.PlatformLivetelecastStatisticsVo;
import com.wxzz.elearning.common.vo.JgPageVo;
import com.wxzz.elearning.common.vo.ReturnVO;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 平台直播 服务类
 * </p>
 *
 * @author
 * @since 2021-04-02
 */
public interface IPlatformLivetelecastService extends IService<PlatformLivetelecast> {

    /**
     * 新增平台直播(总后台)
     *
     * @param platformLivetelecast
     * @return
     */
    ReturnVO savePlatformLivetelecast(PlatformLivetelecast platformLivetelecast);

    /**
     * 修改平台直播(总后台)
     *
     * @param platformLivetelecast
     * @return
     */
    ReturnVO updatePlatformLivetelecast(PlatformLivetelecast platformLivetelecast);

    /**
     * 更新在线人数(0-减一 1-加一)
     * @param update
     * @return
     */
    ReturnVO updateOnlinePersonNum(Long platformLivetelecastId,Integer update);

    /**
     * 平台直播列表(总后台)
     *
     * @param platformLivetelecastDto
     * @return
     */
    ReturnVO<JgPageVo<List<PlatformLivetelecast>>> listPlatformLivetelecast(PlatformLivetelecastDto platformLivetelecastDto);

    /**
     * 平台直播列表(小程序)
     *
     * @param wxPlatformLivetelecastDto
     * @return
     */
    ReturnVO<JgPageVo<List<PlatformLivetelecast>>> wxListPlatformLivetelecast(WxPlatformLivetelecastDto wxPlatformLivetelecastDto);


    /**
     * 平台直播详情(小程序)
     *
     * @param wxUserId
     * @param platformLivetelecastId
     * @return
     */
    ReturnVO<PlatformLivetelecast> selectWxPlatformLivetelecastDetail(Long wxUserId, Long platformLivetelecastId);

    /**
     * 平台直播详情(总后台)
     *
     * @param platformLivetelecastId
     * @return
     */
    ReturnVO<PlatformLivetelecast> selectPlatformLivetelecastDetail(Long platformLivetelecastId);

    /**
     * 删除直播
     *
     * @param platformLivetelecastId
     * @return
     */
    ReturnVO deletePlatformLivetelecast(Long platformLivetelecastId);

    /**
     * 请求上传媒资(返回上传url)
     *
     * @return
     */
    ReturnVO sendVodFile(Long platformLivetelecastId);

    /**
     * 确认上传成功
     *
     * @param assetId
     * @return
     */
    ReturnVO confirmSend(String assetId);

    /**
     * 直播预约(小程序)
     *
     * @return
     */
    ReturnVO saveWxUserPlatformLivetelecast(String token, JSONObject jsonObject, WxUserPlatformLivetelecastInsDto wxUserPlatformLivetelecastInsDto);

    /**
     * 展示我预约的直播(小程序)
     *
     * @param myWxPlatformLivetelecastDto
     * @return
     */
    ReturnVO<JgPageVo<List<PlatformLivetelecast>>> listMyPlatformLivetelecast(Long wxUserId, MyWxPlatformLivetelecastDto myWxPlatformLivetelecastDto);

    /**
     * 展示我预约的活动(小程序)
     *
     * @param wxUserId
     * @param myWxPlatformLivetelecastDto
     * @return
     */
    ReturnVO<JgPageVo<List<Activity>>> listMyActivity(Long wxUserId, MyWxPlatformLivetelecastDto myWxPlatformLivetelecastDto);

    /**
     * 初始化聊天室
     *
     * @param platformLivetelecastId
     * @return
     */
    ReturnVO<Map> initIM(Long platformLivetelecastId);

    /**
     * 直播支付成功确认(远程调用)
     *
     * @param userOrderId
     * @return
     */
    ReturnVO<String> handlerNotifyLive(Long userOrderId);

    /**
     * 直播推流状态的回调
     *
     * @param callbackEntity
     * @return
     */
    Boolean livePushCallback(LivePushCallbackEntity callbackEntity);

    /**
     * 用户观看直播记录观看时间
     *
     * @param wxUserId
     * @return
     */
    ReturnVO seeReturn(Long wxUserId, SeeReturnDto seeReturnDto);

    /**
     * 直播打赏
     *
     * @return
     */
    ReturnVO liveReward(JSONObject jsonObject, LiveRewardDto liveRewardDto);

    /**
     * 支付回调修改打赏金额(远程调用)(返回讲师id)
     *
     * @return
     */
    ReturnVO<Long> updateRewardAmount(Map<String, String> map);

    /**
     * 直播邀请排行榜
     *
     * @param listInvitedWxUserDto
     * @return
     */
    ReturnVO<JgPageVo<List<WxUserPlatformLivetelecast>>> listInvitedWxUser(ListInvitedWxUserDto listInvitedWxUserDto);

    /**
     * 查询自己的邀请
     *
     * @param wxUserId
     * @return
     */
    ReturnVO<WxUserPlatformLivetelecast> selectMyInvited(Long wxUserId, Long platformLivetelecastId);


    /**
     * 查询该直播对应的统计数据
     *
     * @param platformLivetelecastId
     * @return
     */
    ReturnVO<PlatformLivetelecastStatisticsVo> selectPlatformLivetelecastStatisticsVo(Long platformLivetelecastId);

    /**
     * 总直播数(远程调用)
     *
     * @return
     */
    Integer countByPlatformLivetelecast();

    /**
     * 总活动数(远程调用)
     *
     * @return
     */
    Integer countByActivity();

    /**
     * 根据讲师id查询直播时长(远程调用)
     *
     * @param docentId
     * @return
     */
    Integer selectPlatformLivetelecastTimeByDocentId(Long docentId);

    /**
     * 根据讲师id查询直播数量(远程调用)
     *
     * @param docentId
     * @return
     */
    Integer selectPlatformLivetelecastNumByDocentId(Long docentId);
}
